home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / riblitzlibs.lha / riblitzlibs / fns / FNSTest.asc < prev    next >
Encoding:
Text File  |  2002-02-02  |  2.6 KB  |  108 lines

  1. ;FNS library (C)1994 Reflective Images
  2. ;Example program
  3. ;By Stephen McNamara
  4. ;Please feel free to use any part of the program
  5. ; in whatever way you feel like
  6.  
  7. ;Some constants for use when setting FNSPrefs
  8. #none=0
  9. #centred=%1
  10. #bold=%10
  11. #underline=%100
  12. #rightalign=%1000
  13.  
  14. ;Set up a palette
  15. PalRGB 0,1,15,15,0
  16. For h=2 To 15
  17.   PalRGB 0,h,h,h,h
  18. Next h
  19.  
  20. ;Get a bitmap to print onto
  21. BitMap 0,320,200,4
  22.  
  23. ;Go into blitz mode and set up a slice
  24. BLITZ
  25. Slice 0,44,320,200,$fff8,4,8,16,320,320
  26. Show 0
  27. Use Palette 0
  28.  
  29. ;Set output to our bitmap
  30. Use BitMap 0
  31. BitMapOutput 0
  32.  
  33. ;Draw a little box
  34. For x.w=10 To 319
  35.   Line x,0,x-10,14,6
  36. Next x
  37.  
  38. ;Install our font as number 1
  39. #font=1
  40. suc.l=InstallFNS(#font,?font_dat)
  41.  
  42. ;If suc.l doesn't equal #font then an error occured
  43. If suc<>#font Then AMIGA : Request Str$(suc),"Bugger","Okay" : End
  44.  
  45. BLITZ
  46. ;set font output to bitmap and adjust FNS
  47. ;clipping area To full BitMap size
  48. FNSOutput 0,1
  49.  
  50. ;Set centred text ON and select colour number 15 for drawing with
  51. FNSPrefs #centred,15
  52.  
  53. ;Print a title for the screen centred around x=160
  54. FNSPrint #font,160,0,"FNS Library Simple Demonstration"
  55.  
  56. ;Print some left aligned text in the default font (font number 0)
  57. FNSPrefs #none,12
  58. FNSPrint 0,0,30,"Left aligned text!"
  59.  
  60. ;Print some right aligned text WITHOUT changing font preferences
  61. FNSPrint 0,319,40,"Right aligned text!",#rightalign,12
  62.  
  63. ;Print a string from an address, centred on the screen
  64. ;in bold and with colour changing!
  65. FNSPrint 0,160,60,?print_line,#centred|#bold,15
  66.  
  67. FNSPrint #font,160,80,"Do you like my nice font printing?",#centred,1
  68.  
  69. FNSPrint 0,160,110,"You can do....",#centred,15
  70. ;set preferences to bold and underline
  71. FNSPrefs #centred|#underline|#bold,12
  72. FNSPrint 0,160,120,"Centred, bold and underlined!"
  73.  
  74. FNSPrint #font,160,140,"Its FAST and full CLIPPED!",#centred,1
  75.  
  76. ;Set our tab spacing to 32 pixels
  77. FNSSetTab 32
  78. ;Set our preferences and ink colour
  79. FNSPrefs #none
  80. FNSInk 10
  81.  
  82. ;Print font proportions
  83. ;Uses: ASCii 9 to aligned font proportions on a tab spacing
  84. ;      ASCii 1 to signal text colour change
  85. ;      ASCii 15 after ASCii 1 says to change colour to number 15
  86. FNSPrint 0,0,170,"FNSWidth : "+Chr$(9)+Chr$(1)+Chr$(15)+Str$(FNSWidth(1))
  87. FNSPrint 0,0,180,"FNSHeight: "+Chr$(9)+Chr$(1)+Chr$(15)+Str$(FNSHeight(1))
  88. FNSPrint 0,0,190,"FNSUnderline: "+Chr$(9)+Chr$(1)+Chr$(15)+Str$(FNSUnderline(1))
  89. MouseWait
  90. End
  91.  
  92. INCDIR ""
  93. Even
  94.  
  95. ;Incbin our font into the compiled file to save effort later
  96. font_dat: IncBin "FNS:Times15.FNS"
  97.  
  98. ;A string to print that uses ASCii 1 to make the printing routines
  99. ;change output colour
  100. print_line:
  101.   Dc.b "Th",1,14,"is ",1,13,"li",1,12,"ne ",1,11,"ch",1,10,"an",1,9
  102.   Dc.b "ge",1,8,"s ",1,7,"CO",1,6,"LO",1,5,"UR",1,4,"!",0
  103.  
  104.   NPrint "Cudd"
  105.  
  106.  
  107.  
  108.